﻿/*----------------------------------------------------------------
 * 
 * 版权所有：同程网络科技股份有限公司 Copyright (C) 2013
 * 
 * 文件名：ProjectController.cs
 * 文件功能描述：
 * 
 * 
 * 作 者：张强5374
 * 邮 箱：zq5374@17u.cn
 * 日 期：2013-07-05 14:42:14
 * 
 * 
 * 修改标识： Author
 * 修改描述： 相关描述
 * 
 * ---------------------------------------------------------------- */

using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Web.Mvc;
using System.Xml;
using System.Xml.Serialization;
using FunnyFace.Common;
using WebClientPlatform.Models;

namespace WebClientPlatform.Controllers
{
    public class ProjectController : Controller
    {


        public ActionResult All()
        {
            XmlNodeList nodes = XMLHelper.GetXmlNodeListByXpath(Server.MapPath("/App_Data/XMLFile1.xml"), "Projects");

            //foreach (XmlNode node in nodes)
            //{
            //    if (node.HasChildNodes)
            //    {
            //        foreach (XmlNode VARIABLE in node.ChildNodes)
            //        {

            //        }
            //    }
            //}
            XmlSerializer ser = new XmlSerializer(typeof(List<Project>));


            //IList<Project> p = new List<Project>()
            //    {
            //        new Project()
            //            {
            //                Name = "zhang"
            //            }
            //    };

            //FileStream fs = System.IO.File.Create(Server.MapPath("/App_Data/XMLFile11.xml"));

            //ser.Serialize(fs, p);

            //fs.Close();
            IList<Project> projects = null;
            using (FileStream stream = System.IO.File.OpenRead(Server.MapPath("/App_Data/XMLFile1.xml")))
            {
                projects = ser.Deserialize(stream) as List<Project>;
            }




            return View(projects);
        }


    }



}